package com.chinatechstar.component.commons.enums;


public enum SequenceTypeEnum {
    DAY("1", "日"),
    MONTH("2", "月"),
    YEAR("3", "年"),
    UNLIMITED("9", "不刷新");

    public final String code;
    public final String name;

    SequenceTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    public static SequenceTypeEnum getEnumByCode(String Code) {
        for (SequenceTypeEnum sequenceTypeEnum :
                SequenceTypeEnum.values()) {
            if (sequenceTypeEnum.code.equals(Code)) {
                return sequenceTypeEnum;
            }
        }
        throw new RuntimeException("枚举查询错误");
    }

    public static SequenceTypeEnum getEnumByName(String name) {
        for (SequenceTypeEnum sequenceTypeEnum :
                SequenceTypeEnum.values()) {
            if (sequenceTypeEnum.name.equals(name)) {
                return sequenceTypeEnum;
            }
        }
        throw new RuntimeException("枚举查询错误");
    }
}
